package launch

import (
	"context"
	"os"
)

type Version struct {
	ctx context.Context
}

func NewVersion() *Version {
	p := &Version{}

	return p
}

func (v *Version) SetContext(ctx context.Context) {
	v.ctx = ctx
}

func (v *Version) GetAllVersionsFromGameDir(dir string) []string {
	versionLists := []string{}

	subDirNames, err := os.ReadDir(dir + "/versions")

	if err != nil {
		return nil
	}

	for _, giao := range subDirNames {
		versionLists = append(versionLists, giao.Name())
	}

	return versionLists
}
